<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/static/js/jquery-1.12.4.js"></script>
    <script type="text/javascript">
        function login() {
            $.ajax({
                type: "post",
                url: "/login/login",
                data: {
                    "username": $("#username").val(),
                    "password": $("#password").val()
                },
                dataType: "json",
                beforeSend: function () {
                },
                success: function (data) {
                    alert(data);
                }, complete: function () {//完成响应
                },
                error: function (data) {
                    console.info("error: " + data.message);
                }
            });
        }

    </script>
</head>
<body>
    <table>
        <tr>
            <th>用户名：</th>
            <td><input type="text" id="username"></td>
        </tr>
        <tr>
            <th>密码：</th>
            <td><input type="text" id="password"></td>
        </tr>

        <tr>
            <td colspan="2">
                <input type="button" onclick="login()" value="登录">
            </td>
        </tr>

    </table>
</body>
</html>